package sjtu.rfid.rri.services.leaf;

import java.util.List;

import javax.jws.WebService;

import sjtu.rfid.rri.services.leaf.model.ReaderConfig;
import sjtu.rfid.rri.services.leaf.model.ReaderStatus;

/**
 * The operation interface of Reader
 * 
 * @author jinghao
 * 
 */
@WebService
public interface ReaderOperation {

	/**
	 * return a list of ReaderConfig according to the specified readerStatus
	 * 
	 * @param readerStatus
	 *            specify a matching condition for returned interested list of
	 *            ReaderConfig using status of the readers
	 * @return return a list of ReaderConfig
	 * @throws OperationException
	 *             if the operation failed to complete
	 */
	public List<ReaderConfig> getReaderLists(ReaderStatus readerStatus)
			throws OperationException;

	/**
	 * create a new reader
	 * 
	 * @param readerConfig
	 *            the reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 */
	public void createReader(ReaderConfig readerConfig)
			throws OperationException;

	/**
	 * create a new reader
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void deleteReader(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * modify an existing reader specified by the readerID
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param newReaderConfig
	 *            the new reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void modifyReader(String readerID, ReaderConfig newReaderConfig)
			throws OperationException, NoSuchReaderIDException;

	/**
	 * reload an existing reader specified by the readerID. This is equal to the
	 * combination of deleteReader and createReader.
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void reloadReader(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * reset (hardware) an existing reader specified by the readerID.
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param readerInfo
	 *            the reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void resetReader(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * make specified reader begin to do reading
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param readerInfo
	 *            the reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void startReading(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * make specified reader begin to stop reading
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param readerInfo
	 *            the reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void stopReading(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * make specified reader begin to pause reading
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param readerInfo
	 *            the reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void pauseReading(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * make specified reader begin to resume reading
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param readerInfo
	 *            the reader configuration information
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public void resumeReading(String readerID) throws OperationException,
			NoSuchReaderIDException;

	/**
	 * get the status of specified reader
	 * 
	 * @param readerID
	 *            the unique ID of a reader
	 * @param readerInfo
	 *            the reader configuration information
	 * @return the status of specified reader
	 * @throws OperationException
	 *             if the operation failed to complete
	 * @throws NoSuchReaderIDException
	 *             if the readerID specified by client can't be found
	 */
	public ReaderStatus getReaderStatus(String readerID)
			throws OperationException, NoSuchReaderIDException;

}
